<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:p="http://primefaces.org/ui"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:composite="http://xmlns.jcp.org/jsf/composite">
	<composite:interface>
		<composite:attribute name="tickRenderer" required="true" type="org.plotfaces.renderer.CanvasAxisTickRenderer"/>
		<composite:attribute name="collapseHandler" required="true" type="org.plotfacesdemo.CollapseHandler"/>
		<composite:attribute name="plot" required="true" type="java.lang.String"/>
	</composite:interface>

    <composite:implementation>

		<!--
			All message resources should have the _canvasAxisTickRenderer suffix.
		-->

		<p:panel id="canvasAxisTickRenderer" closable="false" toggleable="true" collapsed="#{not cc.attrs.collapseHandler.isVisible('canvasAxisTickRenderer')}" header="#{msg.canvasAxisTickRenderer}">
			<p:ajax event="toggle" listener="#{cc.attrs.collapseHandler.handleToggle}" />
			<p:panelGrid id="canvasAxisTickRendererGrid" columns="3">
				<h:panelGroup>
					#{msg.angle_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.tickRenderer.angle}" rendered="#{cc.attrs.tickRenderer.angle != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.tickRenderer.setAngle( 320 )}" rendered="#{cc.attrs.tickRenderer.angle == null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.tickRenderer.angle != null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.angle}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.angle_canvasAxisTickRenderer_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.labelPosition_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:selectOneMenu value="#{cc.attrs.tickRenderer.labelPosition}" rendered="#{cc.attrs.tickRenderer.labelPosition != null}">
						<f:selectItems value="#{enumTypes.axisTickLabelPositions}"/>
						<p:ajax update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					</p:selectOneMenu>

					<p:commandButton value="#{msg.initialize}" rendered="#{cc.attrs.tickRenderer.labelPosition == null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.labelPosition}" value="auto" />
					</p:commandButton>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.tickRenderer.labelPosition != null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.labelPosition}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.labelPosition_canvasAxisTickRenderer_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.fontWeight_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.tickRenderer.fontWeight}" rendered="#{not empty cc.attrs.tickRenderer.fontWeight}">
						<p:ajax update="#{cc.attrs.plot}"/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.tickRenderer.setFontWeight( 'bold' )}" rendered="#{empty cc.attrs.tickRenderer.fontWeight}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{not empty cc.attrs.tickRenderer.fontWeight}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.fontWeight}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.fontWeight_canvasAxisTickRenderer_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.fontStretch_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.tickRenderer.fontStretch}" rendered="#{cc.attrs.tickRenderer.fontStretch != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.tickRenderer.setFontStretch( 1.5 )}" rendered="#{cc.attrs.tickRenderer.fontStretch == null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.tickRenderer.fontStretch != null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.fontStretch}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.fontStretch_canvasAxisTickRenderer_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.enableFontSupport_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:selectBooleanButton offLabel="#{msg.no}" onLabel="#{msg.yes}" value="#{cc.attrs.tickRenderer.enableFontSupport}" rendered="#{cc.attrs.tickRenderer.enableFontSupport != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
					</p:selectBooleanButton>

					<p:commandButton value="#{msg.initialize}" actionListener="#{cc.attrs.tickRenderer.setEnableFontSupport( true )}" rendered="#{cc.attrs.tickRenderer.enableFontSupport == null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.tickRenderer.enableFontSupport != null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.enableFontSupport}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.enableFontSupport_canvasAxisTickRenderer_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.pt2px_canvasAxisTickRenderer}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.tickRenderer.pt2px}" rendered="#{cc.attrs.tickRenderer.pt2px != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.tickRenderer.setPt2px( 1.0 )}" rendered="#{cc.attrs.tickRenderer.pt2px == null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.tickRenderer.pt2px != null}" update="canvasAxisTickRendererGrid #{cc.attrs.plot}">
						<f:setPropertyActionListener target="#{cc.attrs.tickRenderer.pt2px}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.pt2px_canvasAxisTickRenderer_notes}
				</h:panelGroup>
			</p:panelGrid>
		</p:panel>
	</composite:implementation>
</html>

